<%@ include file="/WEB-INF/views/taglib.jsp" %>
<h3>Asset Model Form</h3>	
	<form:form id="form" method="post" modelAttribute="assetModel"  cssClass="simpleForm">
		<form:hidden path="assetModelId" />
		<form:hidden path="active" />
		<div class="clear" style="height:1px">&nbsp;</div>
		<jsp:include page="/WEB-INF/views/message.jsp"></jsp:include>
	  	<fieldset>
	  		<legend>Asset Model Info</legend>
	  		<p>
	  		<aims:column cssErrorClass="error" path="assetModelCode" >
	  		<form:label path="assetModelCode">
	  			Asset Model Code  * 
	 		</form:label>
	  		<form:input path="assetModelCode" /> <form:errors path="assetModelCode"  cssClass="errorSimple" /> 
			</aims:column>
			<aims:column cssErrorClass="error" path="assetModelName" >
	  		<form:label path="assetModelName">
	  			Asset Model Name * 
	 		</form:label>
	  		<form:input path="assetModelName"  size="50" /> <form:errors path="assetModelName"  cssClass="errorSimple" />	 
			</aims:column>
			<aims:column cssErrorClass="error" path="assetType" >
	  		<form:label path="assetCategory">
	  			Asset Type *
	 		</form:label>
	 		<form:select path="assetType">
	 			<form:option value=""></form:option>
	 			<form:options items="${globalAssetType}" itemValue="systemCode1" itemLabel="systemCodeValueDescription" />
	 		</form:select>
	  		 <form:errors path="assetType"  cssClass="errorSimple" />	 
			</aims:column>
			<aims:column cssErrorClass="error" path="assetCategory" >
	  		<form:label path="assetCategory">
	  			Asset Category *
	 		</form:label>
	 		<form:select path="assetCategory">
	 			<form:option value=""></form:option>
	 			<form:options items="${globalAssetCategory}" itemValue="systemCode1" itemLabel="systemCodeValueDescription" />
	 		</form:select>
	  		 <form:errors path="assetCategory"  cssClass="errorSimple" />	 
			</aims:column>
			
			<aims:column cssErrorClass="error" path="reorderQuantity" >
	  		<form:label path="reorderQuantity">
	  			Reorder Quantity 
	 		</form:label>
	 		 <form:input path="reorderQuantity" />
	  		 <form:errors path="reorderQuantity"  cssClass="errorSimple" />	 
			</aims:column>
			
			<aims:column cssErrorClass="error" path="maintainOrderQuantity" >
	  		<form:label path="maintainOrderQuantity">
	  			MOQ 
	 		</form:label>
	 		 <form:input path="maintainOrderQuantity" />
	  		 <form:errors path="maintainOrderQuantity"  cssClass="errorSimple" />	 
			</aims:column>
			
			<aims:column cssErrorClass="error" path="unitOfMeasurement" >
	  		<form:label path="unitOfMeasurement">
	  			Unit of Measurement 
	 		</form:label>
	 		 <form:input path="unitOfMeasurement" />
	  		 <form:errors path="unitOfMeasurement"  cssClass="errorSimple" />	 
			</aims:column>
			
			<aims:column cssErrorClass="error" path="accessDepartment" >
	  		<form:label path="accessDepartment">
	  			Access Department  
	 		</form:label>
	 		
	 		<c:choose>
	 			<c:when test="${currentSystemUser.department!=null}">
	 				${currentSystemUser.department.departmentName}
	 				<form:hidden path="accessDepartment.departmentId" />
	 			</c:when>
	 			<c:otherwise>
	 				<form:select id="departmentId" path="accessDepartment.departmentId">
			 			<form:option value=""></form:option>
			 			<form:options items="${globalDepartment}" itemValue="departmentId" itemLabel="departmentName" />
			 		</form:select> <form:errors path="accessDepartment"  cssClass="errorSimple" />	
	 			</c:otherwise>
	 		</c:choose>
	  		 
			</aims:column>
			</fieldset>
      <div class="action">
	  	<c:choose>
	  		<c:when test="${assetModel.assetModelId==null}">
	  			<button type="submit" class="button positive">
	  			Save
	  			</button>
	  			<a href="<c:url value="/assetModel/search" />" class="button">Back</a>
	  		</c:when>
	  		<c:when test="${assetModel.assetModelId!=null}">
  				<button type="submit"  class="button positive">Update</button>
  				<c:url value="/assetModel/initialBalance/${assetModel.assetModelId }" var="initialBalanceUrl"></c:url>
	  			<a href="${initialBalanceUrl}" class="button">Initial Balance</a>
  				<a href="<c:url value="/assetModel/search" />" class="button">Back</a>
  				
	  		</c:when>
	  	</c:choose>
	 </div>	
	</form:form>
	
	<script type="text/javascript">
		$(document).ready(function() {
			<c:if test="${assetModel.assetModelId!=null }">
				//readonlyAttr('#assetModelCode');
			</c:if>		
					
		});
	</script>